﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GraphGeneration
{
    public class Vertex
    {

        public IGraph G;
        public int ID { get; private set; }
        int EdgeCount;
        List<Edge> Edges;

        public Vertex(IGraph g) : this(g, (Edge)null) { }

        public Vertex(IGraph g, Edge e)
        {
            Edges = new List<Edge>();
            EdgeCount = 0;
            if (e != null)
                addEdge(e);           
            G = g;
            ID = g.getVertexID();
        }

        public Vertex(IGraph g, List<Edge> EdgeList)
        {
            Edges = EdgeList;
            EdgeCount = EdgeList.Count;            
            G = g;
        }

        public void addEdge(Edge e)
        {
            Edges.Add(e);
            EdgeCount++;
        }

        public bool RemoveEdge(Edge e)
        {
            if (Edges.Remove(e))
            {
                EdgeCount--;
                return true;
            }
            return false; 
        }

        override public String ToString()
        {
            return (ID+1).ToString();
        }

    }
}
